package com.fesine.ch02.synchronizedBlockLockAll.test2;

/**
 * @description: synchronized(object)将object本身作为对象监视器，
 * 此时，1、synchronized(object)中的同步代码块同步执行
 *      2、object中的同步方法也是同步执行
 *      3、object中的synchronized(this)同步执行
 * @author: Fesine
 * @createTime:2016/7/5 16:37
 * @update:修改内容
 * @author: Fesine
 * @updateTime:2016/7/5 16:37
 */
public class Run {
    public static void main(String[] args) throws InterruptedException {
        Service service = new Service();
        MyObject object = new MyObject();
        ThreadA a = new ThreadA(service, object);
        a.setName("A");
        a.start();
        Thread.sleep(100);
        ThreadB b = new ThreadB(object);
        b.setName("B");
        b.start();
    }

}
